import { Entity, Column, PrimaryGeneratedColumn, OneToOne, JoinColumn } from "typeorm";
import { Photo } from "./Photo";

@Entity()
export class PhotoMetadata {
  @PrimaryGeneratedColumn()
  id: number;

  @Column("int")
  height: number;

  @Column("int")
  width: number;

  @Column()
  compressed: boolean;

  @Column()
  comment: string;

  @OneToOne(type => Photo, photo => photo.metadata, { cascade: true })
  @JoinColumn()
  photo: Photo;
}
